package com.zking.service.impl;

import com.zking.dao.domain.SysResources;
import com.zking.dao.mapper.SysResourcesMapper;
import com.zking.service.ResourcesService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ResourcesServiceImpl implements ResourcesService {
    @Autowired
    private SysResourcesMapper sysResourcesMapper;

    @Override
    public List<SysResources> selectAll() {
        List<SysResources> resourcesList = sysResourcesMapper.selectAll();
        return resourcesList;
    }

    @Override
    public int addResources(List<SysResources> resourcesAdd) {
        int count = 0;
        for (SysResources resources : resourcesAdd) {
            if (sysResourcesMapper.insert(resources) > 0) {
                count++;
            }
        }
        return count;
    }
}
